package consts

import (
	"fmt"
	"strings"
)

const (
	RedisKeyStockSymbols = "stock:symbols" // 股票列表
)

// RedisKeyStockInfo 股票信息 eg: stock:info:sh600000
func RedisKeyStockInfo(symbol string) string {
	return fmt.Sprintf("stock:info:%s", strings.ToLower(symbol))
}

// RedisKeyExchangeSymbols 交易所股票列表 eg: exchange:sh:symbols
func RedisKeyExchangeSymbols(exchange string) string {
	return fmt.Sprintf("exchange:symbols:%s", strings.ToLower(exchange))
}

// RedisKeyRealtimeStorage 实时行情存储 eg: stock:storage:sh600000:1611111111
func RedisKeyRealtimeStorage(symbol string, timestamp int64) string {
	return fmt.Sprintf("stock:storage:%s:%d", symbol, timestamp)
}

// RedisKeyStockKline 股票K线 eg: stock:kline:sh600000:1m
func RedisKeyStockKline(symbol, period string) string {
	return fmt.Sprintf("stock:kline:%s:%s", strings.ToLower(symbol), period)
}
